﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;

namespace VisualStudioAchievements
{
    public class Niner : INotifyPropertyChanged
    {
        string _alias;
        public string Alias
        {
            get
            {
                return _alias;
            }
            set
            {
                if (_alias != value)
                {
                    _alias = value;
                    NotifyPropertyChanged("Alias");
                }
            }
        }

        string _name;
        [XmlIgnore]
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                if (_name != value)
                {
                    _name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }

        Uri _avatar;
        [XmlIgnore]
        public Uri Avatar
        {
            get
            {
                return _avatar;
            }
            set
            {
                if (_avatar != value)
                {
                    _avatar = value;
                    NotifyPropertyChanged("Avatar");
                }
            }
        }

        List<Achievement> _achievements;
        [XmlIgnore]
        public List<Achievement> Achievements
        {
            get
            {
                return _achievements;
            }
            set
            {
                if (_achievements != value)
                {
                    _achievements = value;
                    NotifyPropertyChanged("Achievements");
                }
            }
        }

        string _caption;
        [XmlIgnore]
        public string Caption
        {
            get
            {
                return _caption;
            }
            set
            {
                if (_caption != value)
                {
                    _caption = value;
                    NotifyPropertyChanged("Caption");
                }
            }
        }

        int _points;
        [XmlIgnore]
        public int Points
        {
            get
            {
                return _points;
            }
            set
            {
                if (_points != value)
                {
                    _points = value;
                    NotifyPropertyChanged("Points");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }
    }
}
